Fix the install break in write_models_tsv (main is broken for new users) - #19
Open
BeLazy167 wants to merge 1 commit into
Open
Fix the install break in write_models_tsv (main is broken for new users)#19BeLazy167 wants to merge 1 commit into
BeLazy167 wants to merge 1 commit into
Conversation
… right surface A fresh install from main currently FAILS (verified: exit 1, right after "default model"). Two bugs: - The row loop's last statement is `[ -n id ] && [ -n ctx ] && printf`, which returns non-zero when the final row has no context window. That makes the whole `while` non-zero and `set -e` aborts the installer. A row without a context window is normal, not an error. - write_models_tsv was fed the Anthropic surface's body (/v1/models), which publishes no context windows at all — so even without the crash every model would fall back to the hardcoded table. That table omits gpt-5.6-luna, gpt-5.6-terra, gpt-5.5 and gpt-5.3-codex, which would then inherit Claude Code's 200k assumption and re-compact on every turn: exactly the reported symptom, on exactly the model reported (luna). Now fetches the OpenAI-compat surface (/models), which carries `_qbraid.maxTokens`. Verified: install exits 0, models.tsv has all 12 correct windows (gpt-5.6-* = 1_050_000, gpt-5.4* = 400_000, claude-* = 1_000_000/200_000), and default / gpt-1M / gpt-400k sessions all answer. Also confirms the [1m] suffix is safe: Claude Code strips it before the request, so the gateway never sees claude-sonnet-4-6[1m] (which it 404s).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A fresh install from
mainfails right now — exit 1 immediately after "default model". Reproduced deterministically; two bugs.1. The install-breaking one
That compound is the last statement in the loop body, so when the final row has no context window it returns non-zero → the
whilereturns non-zero →set -eaborts the installer. A row without a context window is normal, not an error.Same class as the json-extractor and
strings | grep -qbugs — a construct that fails on an ordinary outcome, underset -euo pipefail.2. The one that re-creates the compaction bug
write_models_tsvwas fedAPI_BODYleft over from the Anthropic surface (/v1/models), whose entries are{id, created_at, display_name, type}— no context windows at all. So even without the crash, every model would fall back to the hardcoded table, and that table omits gpt-5.6-luna, gpt-5.6-terra, gpt-5.5, gpt-5.3-codex. Those four would inherit Claude Code's 200k assumption for unknown ids and re-compact every turn — precisely the reported symptom, on precisely the reported model (luna).Now fetches the OpenAI-compat surface (
/models), which publishes_qbraid.maxTokens.Verified
install.shmodels.tsvgpt-5.6-*/gpt-5.5= 1,050,000 ·gpt-5.4*/codex= 400,000 ·claude-*= 1,000,000 / 200,000--model gpt-5.6-sol(1M class)--model gpt-5.4-mini(400k class)Also resolves the
[1m]question: Claude Code strips the suffix before the request, so the gateway never seesclaude-sonnet-4-6[1m]— which it does 404 if sent directly. The[1m]branch is safe as written.